using System;
using System.Data.Services.Client;

namespace oDataScaffoldingSample.Models
{
    public class oDataScaffoldingSampleContext : DataServiceContext
    {
		public oDataScaffoldingSampleContext()
            : base(new Uri(oDataScaffoldingSample.Properties.Settings.Default.oDataScaffoldingSampleContext))
        {
            this.ResolveName = delegate(Type entityType)
            {
                return entityType.FullName;
            };
            this.ResolveType = delegate(string entitySetName)
            {
                return Type.GetType(entitySetName);
            };
        }

        
        private DataServiceQuery<Model.Person> _People;
        public DataServiceQuery<Model.Person> People
        { 
        	get 
        	{
        		if (_People == null)
        		{						
        
        			_People = base.CreateQuery<Model.Person>("People");
        		}
        		return _People; 
        	} 
        }
        
        public void AddToPeople(Model.Person entity)
        {
            base.AddObject("People", entity);
        }
        
        public void DeleteFromPeople(Model.Person entity)
        {
            base.DeleteObject(entity);
        }
        
        public void AttachToPeople(Model.Person entity)
        {
            base.AttachTo("People", entity);
        }
        


    }
}